package cn.xudy.sso.controlled;


import cn.xudy.sso.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.client.OAuth2RestOperations;
import org.springframework.web.bind.annotation.*;


@RestController
public class ClientControlled {

    @Autowired
    private OAuth2RestOperations oauthRestTemplate;


    @PostMapping(value = "/login")
    public String  saveCuringEvidence(@RequestBody User user ){

        System.out.println("---------------------Client"+user.getUsername());
        oauthRestTemplate.postForEntity("http://192.168.1.100:9595/log",user,String.class);

        return user.getUsername();
    }


    @GetMapping(value = "/otherPage")
    public String  otherPage(){

        System.out.println("---------------------otherPage");
//        oauthRestTemplate.postForEntity("http://192.168.1.100:9595/log",user,String.class);
        return "00000";
    }




}
